package person.bing.fbcloud.endpoint;

import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;
import person.bing.fbcloud.handle.ImageCodeHandle;

/**
 * @author: mengfanbing
 * @date: 2020/9/14 13:38
 */
@Configuration
@AllArgsConstructor
public class GatewayEndpoints {
    private ImageCodeHandle imageCodeHandle;
    @Bean
    public RouterFunction<ServerResponse>  routerFunction(){
        return RouterFunctions
                .route(RequestPredicates.GET("/code")
                        .and(RequestPredicates.accept(MediaType.TEXT_PLAIN)),
                        imageCodeHandle);
    }
}
